﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace MonitorClient
{
    [Serializable]
    [XmlRoot("config")]
    public class Config
    {
        [XmlElement("StartupFlag")]
        public string StartupFlag { get; set; }

        [XmlElement("listenPort")]
        public int ListenPort { get; set; }

        [XmlElement("location")]
        public string Location { get; set; }

        [XmlArray("filters")]
        [XmlArrayItem("url", typeof(string))]
        public string[] Filters { get; set; }

        public bool Matched(string url)
        {
            bool result = false;
            foreach (string filter in Filters)
            {
                if (url.Contains(filter))
                {
                    result = true;
                    break;
                }
            }
            return result;
        }
    }
}
